package www.sharetime.weshare.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;

import www.sharetime.weshare.R;
import www.sharetime.weshare.utils.L;

/**
 * File Description  : 币种adapter
 *
 * @author : zhanggeng
 * @version : v1.0
 *          **************修订历史*************
 * @email : zhanggengdyx@gmail.com
 * @date : 2017/9/23 14:32
 */

public class MoneyTypeAdapter extends RecyclerView.Adapter<MoneyTypeAdapter.ViewHolder> {
    public ArrayList<String> getMoneys() {
        return moneys;
    }

    public void setMoneys(ArrayList<String> moneys) {
        this.moneys = moneys;
    }

    ArrayList<String> moneys;
    Context context;

    public MoneyTypeAdapter(ArrayList<String> money, Context context) {
        this.moneys = money;
        this.context = context;
    }

    public void  notifyDataChange(ArrayList<String> list){
        setMoneys(list);
        notifyDataSetChanged();
    }


    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_search_tag, parent, false));
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        L.et("type", moneys.get(position));
        holder.mTextView.setText(moneys.get(position));
    }

    @Override
    public int getItemCount() {
        return moneys.size();
    }


    public static class ViewHolder extends RecyclerView.ViewHolder {
        public View view;
        public TextView mTextView;

        public ViewHolder(View v) {
            super(v);
            mTextView = (TextView) v.findViewById(R.id.tv_search_name);
        }
    }
}
